package com.example._05weibo.base.response;

import jdk.net.SocketFlow;
import lombok.Data;

@Data
public class JsonResult {
      private int code;
      private String message;
      private Object data;

      public JsonResult(StatusCode statusCode){
            this.code = code;
            this.message = message;
      }
      public JsonResult (StatusCode statusCode,Object data){
              this.code = statusCode.getCode();
              this.message = statusCode.getMessage();
      }
      public JsonResult OperationSuccess(Object data){
            return new JsonResult(StatusCode.OPERATION_SUCCESS,data);
      }
      public JsonResult OperationSuccess(){
            return new JsonResult(StatusCode.OPERATION_SUCCESS);
      }
      public JsonResult OperationFail(){
            return new JsonResult(StatusCode.OPERATION_FAIL);
      }
      public JsonResult ValidatedFail(){
            return new JsonResult(StatusCode.VALIDATED_FAIL);
      }
      public JsonResult UserNamePasswordError(){
            return new JsonResult(StatusCode.USERNAME_PASSWORD_ERROR);
      }
      public JsonResult UserNameExist(){
            return new JsonResult(StatusCode.USERNAME_EXIST);
      }
      public JsonResult NotLogin(){
            return new JsonResult(StatusCode.NOT_LOGIN);
      }

}
